.\"	$NetBSD: gettytab.5,v 1.36 2012/04/21 12:27:28 roy Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"     from: @(#)gettytab.5	8.4 (Berkeley) 4/19/94
.\"
.Dd April 5, 2012
.Dt GETTYTAB 5
.Os
.Sh NAME
.Nm gettytab
.Nd terminal configuration data base
.Sh SYNOPSIS
.Nm
.Sh DESCRIPTION
The
.Nm
file
is a simplified version of the
.Xr capfile 5
data base
used to describe terminal lines.
The initial terminal login process
.Xr getty 8
accesses the
.Nm
file each time it starts, allowing simpler
reconfiguration of terminal characteristics.
Each entry in the data base
is used to describe one class of terminals.
.Pp
Where to run
.Xr getty 8
processes is normally defined by
.Xr ttys 5 .
.Pp
There is a default terminal class,
.Em default ,
that is used to set global defaults for all other classes.
(That is, the
.Em default
entry is read, then the entry for the class required
is used to override particular settings.)
The
.Em default
entry is also normally read by other programs that present login prompts
to the user, such as
.Xr telnetd 8 ,
in order to retrieve the values of the
.Em he ,
.Em hn ,
.Em im ,
and
.Em if
capabilities.
.Sh CAPABILITIES
Refer to
.Xr capfile 5
for a description of the file layout.
The
.Em default
column below lists defaults obtained if there is
no entry in the table obtained, nor one in the special
.Em default
table.
.Bl -column Namexx /usr/bin/login Default
.It Sy Name	Type	Default	Description
.It "ab	bool	false	Auto-baud speed select mechanism for the Micom 600 portselector. Selection is done by looking at how the character `\er' is garbled at 300, 1200, 4800, and 9600 baud."
.It "al	str	NULL	user to auto-login instead of prompting"
.It "ap	bool	false	terminal uses any parity"
.It "bk	str	0377	alternative end of line character (input break)"
.It "b2	str	0377	alternative end of line character (input break)"
.It "c0	num	unused	tty control flags to write messages"
.It "c1	num	unused	tty control flags to read login name"
.It "c2	num	unused	tty control flags to leave terminal as"
.It "ce	bool	false	use crt erase algorithm"
.It "ck	bool	false	use crt kill algorithm"
.It "cl	str" Ta Dv NULL Ta
.No "screen clear sequence"
.It "co	bool	false	console - add"
.Ql \er\en
after login prompt
.It "cs	bool	false	clear screen based on terminal type in /etc/ttys"
.It "ds	str" Ta So Li ^Y Sc Ta
.No "delayed suspend character"
.It "dx	bool	false	set"
.Dv DECCTLQ
.It "ec	bool	false	leave echo"
.Tn OFF
.It "ep	bool	false	terminal uses even parity"
.It "er	str" Ta So Li ^? Sc Ta
.No "erase character"
.It "et	str" Ta So Li ^D Sc Ta
.No "end of text"
.Pq Dv EOF
character
.It "ev	str" Ta Dv NULL Ta
.No "initial environment"
.It "f0	num	unused	tty mode flags to write messages"
.It "f1	num	unused	tty mode flags to read login name"
.It "f2	num	unused	tty mode flags to leave terminal as"
.It "fl	str" Ta So Li ^O Sc Ta
.No "output flush character"
.It "hc	bool	false	do"
.Tn NOT
hangup line on last close
.It "he	str" Ta Dv NULL Ta
.No "hostname editing string"
.It "hn	str	hostname	hostname"
.It "ht	bool	false	terminal has real tabs"
.It "i0	num	unused	tty input flags to write messages"
.It "i1	num	unused	tty input flags to read login name"
.It "i2	num	unused	tty input flags to leave terminal as"
.It "if	str	NULL	display named file before prompt, like /etc/issue"
.It "ig	bool	false	ignore garbage characters in login name"
.It "im	str" Ta Dv NULL Ta
.No "initial (banner) message"
.It "in	str" Ta So Li ^C Sc Ta
.No "interrupt character"
.It "is	num	unused	input speed"
.It "kl	str" Ta So Li ^U Sc Ta
.No "kill character"
.It "l0	num	unused	tty local flags to write messages"
.It "l1	num	unused	tty local flags to read login name"
.It "l2	num	unused	tty local flags to leave terminal as"
.It "lc	bool	false	terminal has lower case"
.It "lm	str	login:	login prompt"
.It "ln	str" Ta So Li ^V Sc Ta
.No "``literal next'' character"
.It "lo	str" Ta Pa /usr/bin/login Ta
.No "program to exec when name obtained"
.It "mb	bool	false	do flow control based on carrier"
.It "nl	bool	false	terminal has (or might have) a newline character"
.It "nn	bool	false	do not prompt for a login name"
.It "np	bool	false	terminal uses no parity (i.e. 8-bit characters)"
.It "nx	str	default	next table (for auto speed selection)"
.It "o0	num	unused	tty output flags to write messages"
.It "o1	num	unused	tty output flags to read login name"
.It "o2	num	unused	tty output flags to leave terminal as"
.It "op	bool	false	terminal uses odd parity"
.It "os	num	unused	output speed"
.It "pc	str" Ta So Li \e0 Sc Ta
.No "pad character"
.It "pe	bool	false	use printer (hard copy) erase algorithm"
.It "pf	num	0	delay"
between first prompt and following flush (seconds)
.It "pp	str	unused	PPP authentication program"
.It "ps	bool	false	line connected to a"
.Tn MICOM
port selector
.It "qu	str" Ta So Li \&^\e Sc Ta
.No "quit character"
.It "rp	str" Ta So Li ^R Sc Ta
.No "line retype character"
.It "rw	bool	false	do"
.Tn NOT
use raw for input, use cbreak
.It "sp	num	unused	line speed (input and output)"
.It "st	str" Ta So Li ^T Sc Ta
.No "status character"
.It "su	str" Ta So Li ^Z Sc Ta
.No "suspend character"
.It "tc	str	none	table continuation"
.It "to	num	0	timeout (seconds)"
.It "tt	str" Ta Dv NULL Ta
.No "terminal type (for environment)"
.It "ub	bool	false	do unbuffered output (of prompts etc)"
.It "we	str" Ta So Li ^W Sc Ta
.No "word erase character"
.It "xc	bool	false	do"
.Tn NOT
echo control chars as
.Ql ^X
.It "xf	str" Ta So Li ^S Sc Ta Dv XOFF
(stop output) character
.It "xn	str" Ta So Li ^Q Sc Ta Dv XON
(start output) character
.El
.Pp
The following capabilities are no longer supported by
.Xr getty 8 :
.Bl -column Namexx /usr/bin/login Default
.It "bd	num	0	backspace delay"
.It "cb	bool	false	use crt backspace mode"
.It "cd	num	0	carriage-return delay"
.It "fd	num	0	form-feed (vertical motion) delay"
.It "nd	num	0	newline (line-feed) delay"
.It "uc	bool	false	terminal is known upper case only"
.El
.Pp
If no line speed is specified, speed will not be altered
from that which prevails when getty is entered.
Specifying an input or output speed will override
line speed for stated direction only.
.Pp
Terminal modes to be used for the output of the message,
for input of the login name,
and to leave the terminal set as upon completion,
are derived from the boolean flags specified.
If the derivation should prove inadequate,
any (or all) of these three may be overridden
with one of the
.Em \&c0 ,
.Em \&c1 ,
.Em \&c2 ,
.Em \&i0 ,
.Em \&i1 ,
.Em \&i2 ,
.Em \&l0 ,
.Em \&l1 ,
.Em \&l2 ,
.Em \&o0 ,
.Em \&o1 ,
or
.Em \&o2
numeric specifications, which can be used to specify
(usually in octal, with a leading '0')
the exact values of the flags.
These flags correspond to the termios
.Em c_cflag ,
.Em c_iflag ,
.Em c_lflag ,
and
.Em c_oflag
fields, respectively.
Each these sets must be completely specified to be effective.
The
.Em \&f0 ,
.Em \&f1 ,
and
.Em \&f2
are excepted for backwards compatibility with a previous incarnation of
the TTY sub-system.
In these flags the bottom 16 bits of the (32 bits) value contain the sgttyb
.Em sg_flags
field, while the top 16 bits represent the local mode word.
.Pp
Should
.Xr getty 8
receive a null character
(presumed to indicate a line break)
it will restart using the table indicated by the
.Em nx
entry.
If there is none, it will re-use its original table.
.Pp
Delays are specified in milliseconds, the nearest possible
delay available in the tty driver will be used.
Should greater certainty be desired, delays
with values 0, 1, 2, and 3 are interpreted as
choosing that particular delay algorithm from the driver.
.Pp
The
.Em \&cl
screen clear string may be preceded by a (decimal) number
of milliseconds of delay required (a la termcap).
This delay is simulated by repeated use of the pad character
.Em \&pc .
.Pp
The initial message, and login message,
.Em \&im
and
.Em \&lm
may include any of the following character sequences, which expand to
information about the environment in which
.Xr getty 8
is running.
.Pp
.Bl -tag -width \&%xxx -compact
.It \&%d
The current date.
.It \&%h
The hostname of the machine, which is normally obtained from the
system using
.Xr gethostname 3 ,
but may also be overridden by the
.Em \&hn
table entry.
In either case it may be edited with the
.Em \&he
string.
A '@' in the
.Em \&he
string causes one character from the real hostname to
be copied to the final hostname.
A '#' in the
.Em \&he
string causes the next character of the real hostname
to be skipped.
Each character that
is neither '@' nor '#' is copied into the final hostname.
Surplus '@' and '#' characters are ignored.
.It \&%t
The tty name.
.It "\&%m, \&%r, \&%s, \&%v"
The type of machine, release of the operating system, name of the
operating system, and version of the kernel, respectively, as
returned by
.Xr uname 3 .
.It \&%%
A
.Dq %
character.
.El
.Pp
When getty execs the login process, given
in the
.Em \&lo
string (usually
.Dq Pa /usr/bin/login ) ,
it will have set
the environment to include the terminal type, as indicated
by the
.Em \&tt
string (if it exists).
The
.Em \&ev
string, can be used to enter additional data into
the environment.
It is a list of comma separated strings, each of which
will presumably be of the form
.Em name=value .
.Pp
If a non-zero timeout is specified, with
.Em \&to ,
then getty will exit within the indicated
number of seconds, either having
received a login name and passed control
to
.Xr login 1 ,
or having received an alarm signal, and exited.
This may be useful to hangup dial in lines.
.Pp
Output from
.Xr getty 8
is even parity unless
.Em \&op
or
.Em \&np
is specified.
The
.Em \&op
string
may be specified with
.Em \&ap
to allow any parity on input, but generate odd parity output.
Note: this only applies while getty is being run,
terminal driver limitations prevent a more complete
implementation.
.Xr getty 8
does not check parity of input characters in
.Dv RAW
mode.
.Pp
If
.Em \&pp
string is specified and a Point to Point Protocol
.Pq Tn PPP
link bringup sequence is recognized,
.Xr getty 8
will invoke the program referenced by the
.Em \&pp
string, e.g.
.Xr pppd 8 .
This can be used to handle incoming
.Tn PPP
calls.
.Sh SEE ALSO
.Xr login 1 ,
.Xr gethostname 3 ,
.Xr uname 3 ,
.Xr capfile 5 ,
.Xr ttys 5 ,
.Xr getty 8 ,
.Xr pppd 8 ,
.Xr telnetd 8
.Sh HISTORY
The
.Nm
file format appeared in
.Bx 4.2 .
.Sh BUGS
The special characters (erase, kill, etc.) are reset to system defaults
by
.Xr login 1 .
In
.Em all
cases, '#' or '^H' typed in a login name will be treated as
an erase character, and '@' will be treated as a kill character.
.Pp
The delay stuff is a real crock.
Apart from its general lack of flexibility, some
of the delay algorithms are not implemented.
The terminal driver should support sane delay settings.
.Pp
The
.Em \&he
capability is stupid.
